{{#if redirectedReason}}
  <div class="alert alert-info">{{redirectedReason}}</div>
{{/if}}

{{#if showDismissAtTop}}
  <div class="row">
    {{#if showDismissRead}}
      <button title="{{i18n 'topics.bulk.dismiss_tooltip'}}" id='dismiss-topics-top' class='btn dismiss-read' {{action "dismissReadPosts"}}>{{i18n 'topics.bulk.dismiss_button'}}</button>
    {{/if}}
    {{#if showResetNew}}
      <button id='dismiss-new-top' class='btn dismiss-read' {{action "resetNew"}}><i class="fa fa-check"></i> {{i18n 'topics.bulk.dismiss_new'}}</button>
    {{/if}}
  </div>
{{/if}}

{{bulk-select-button selected=selected action="refresh" category=category}}

{{#discovery-topics-list model=model refresh="refresh" incomingCount=topicTrackingState.incomingCount}}
  {{#if top}}
    <div class='top-lists'>
      {{period-chooser period=period action="changePeriod"}}
    </div>
  {{else}}
    {{#if topicTrackingState.hasIncoming}}
      <div class="show-more {{if hasTopics 'has-topics'}}">
        <div class='alert alert-info clickable' {{action "showInserted"}}>
          {{count-i18n key="topic_count_" suffix=topicTrackingState.filter count=topicTrackingState.incomingCount}}
          {{i18n 'click_to_show'}}
        </div>
      </div>
    {{/if}}
  {{/if}}

  {{#if hasTopics}}
      {{topic-list
          highlightLastVisited=true
          top=top
          showTopicPostBadges=showTopicPostBadges
          showPosters=true
          currentUser=currentUser
          canBulkSelect=canBulkSelect
          changeSort="changeSort"
          toggleBulkSelect="toggleBulkSelect"
          hideCategory=model.hideCategory
          order=order
          ascending=ascending
          bulkSelectEnabled=bulkSelectEnabled
          selected=selected
          expandGloballyPinned=expandGloballyPinned
          expandAllPinned=expandAllPinned
          category=category
          topics=model.topics}}
  {{/if}}
{{/discovery-topics-list}}

<footer class='topic-list-bottom'>
  {{conditional-loading-spinner condition=model.loadingMore}}
  {{#if allLoaded}}
    {{#if showDismissRead}}
      <button title="{{i18n 'topics.bulk.dismiss_tooltip'}}" id='dismiss-topics' class='btn dismiss-read' {{action "dismissReadPosts"}}>{{i18n 'topics.bulk.dismiss_button'}}</button>
    {{/if}}
    {{#if showResetNew}}
      <button id='dismiss-new' class='btn dismiss-read' {{action "resetNew"}}><i class="fa fa-check"></i> {{i18n 'topics.bulk.dismiss_new'}}</button>
    {{/if}}

    {{#if latest}}
      <div class="education">
        {{{footerEducation}}}
      </div>
      <h3>
        {{footerMessage}}
        {{#if canCreateTopicOnCategory}}<a href {{action "createTopic"}}>{{i18n 'topic.suggest_create_topic'}}</a>{{/if}}
      </h3>
    {{else}}
      {{#if top}}
        <h3>
          {{#link-to "discovery.categories"}}{{i18n 'topic.browse_all_categories'}}{{/link-to}}, {{#link-to 'discovery.latest'}}{{i18n 'topic.view_latest_topics'}}{{/link-to}} {{i18n 'or'}} {{i18n 'filters.top.other_periods'}}
        {{top-period-buttons period=period action="changePeriod"}}
        </h3>
      {{else}}
        <div class="education">
            {{{footerEducation}}}
        </div>
        <h3>
          {{footerMessage}}{{#link-to "discovery.categories"}} {{i18n 'topic.browse_all_categories'}}{{/link-to}} {{i18n 'or'}} {{#link-to 'discovery.latest'}}{{i18n 'topic.view_latest_topics'}}{{/link-to}}
        </h3>
      {{/if}}
    {{/if}}
  {{/if}}
</footer>
